package com.chen.corejava.collection;

import java.util.EnumMap;
import java.util.Map;

/**
 *枚举映射表:键为枚举类型的映射表
 *@author：email: <a href="cyb@ewppay.com"> Administrator </a> 
 *@Date 2017-2-21 下午2:19:54 
 */

public class EnumMapTest {

	/**
	 * @param @param args   
	 * @return void  
	 * @throws
	 * @author cyb
	 * @date 2017-2-21
	 */
	public static void main(String[] args) {
		EnumMap<ErrorMsgEnum,String> map = new EnumMap<ErrorMsgEnum,String>(ErrorMsgEnum.class);
		map.put(ErrorMsgEnum.REQUIRED_ITEM_ID, "001");
		map.put(ErrorMsgEnum.INVALID_APP_ID, "002");
		map.put(ErrorMsgEnum.INVALID_DATE, "003");
		
		for(Map.Entry<ErrorMsgEnum, String> entry : map.entrySet()	){
			System.out.println(entry.getKey() + "," + entry.getValue());
		}
	}

	public enum ErrorMsgEnum {
		REQUIRED_ITEM_ID("商品id为必填项"),INVALID_APP_ID("应用标识错误"),INVALID_DATE("时间格式错误");
		
		private String value;
		
		private ErrorMsgEnum(String value){
			this.setValue(value);
		}
		
		public String getValue() {
			return value;
		}

		public void setValue(String value) {
			this.value = value;
		}

	}
}
